package com.nbcb.nwql.common.rtnvo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Slf4j
public class ExceptionResponse<T> {
    private Integer code;
    private String msg;
    private Object body;

    public static <T> ExceptionResponse success(T body) {
        //log.info("返回成功");
        return success(200, "成功", body);
    }

    public static ExceptionResponse success(Integer code, String msg) {
        //log.info("返回成功");
        return success(code, msg, null);
    }

    public static ExceptionResponse fail(String msg) {
        //log.info("返回成功");
        return success(500, msg);
    }

    public static <T> ExceptionResponse success(Integer code, String msg, T body) {
        //log.info("返回成功");
        return new ExceptionResponse(code, msg, body);
    }
}